<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="ElementUI/index.css">


</head>
<body>
<!--https://docs.emmet.io/cheat-sheet/-->
<div id="app">
    <el-form v-bind:rules="myrules" :model="formData">

    <el-form-item label="活动名称" prop="name">
        <el-input v-model="formData.name" placeholder="请输入内容"></el-input>
    </el-form-item>

        <el-select v-model="formData.sex" placeholder="请选择">
            <el-option value="0" label="男"></el-option>
            <el-option value="1" label="女"></el-option>
        </el-select>

        <el-input type="textarea" v-model="formData.area" placeholder="请输入内容"></el-input>

        <el-button type="primary" @click="add">主要按钮</el-button>
    </el-form>
</div>

<script src="ElementUI/vue.js"></script>
<script src="ElementUI/index.js"></script>
<script>
  new Vue({
      el:"#app",
      // data(){ //es6
      //     return{
      //         name:""
      //     }
      // }
      methods:{
          add(){
              console.log(this.formData);
          }
      },

      data:{
          formData:{},
          myrules:{
              name:[
                  { required: true, message: '请输入活动名称', trigger: 'blur' },
                  {
                      validator: (rule,value,callback)=> {
                          if(value == "爸爸"){
                              callback();
                          } else {
                              callback("叫爸爸");
                          }
                      }
                  }
              ]
          }
      }
  })

</script>
</body>
</html>
